package com.mianshi;

import java.util.Scanner;

public class baidu1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int ans = 0;
        for(int i = 1; i <= k; i++){
            ans = Math.max(ans, reverse(i*n));
        }
        System.out.println(ans);
    }

    public static int reverse(int n){
        int res = 0;
        while(n > 0){
            res *= 10;
            res += n % 10;
            n /= 10;
        }
        return res;
    }
}
